﻿<UserControl x:Class="BestCode.Creds.UI.VwEditLayoutTemplate"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:controls="clr-namespace:BestCode.Wpf.Controls;assembly=BestCode.Wpf.Controls"
             xmlns:data="clr-namespace:BestCode.Wpf.Controls.Data;assembly=BestCode.Wpf.Controls.Data"
             xmlns:userControls="clr-namespace:BestCode.Creds.UI.UserControls"
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:converter="clr-namespace:BestCode.Creds.UI.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="1000">
    <UserControl.Resources>
        <converter:ColorConverter x:Key="ColorConverter"></converter:ColorConverter>
    </UserControl.Resources>
    
    <Grid>
        <controls:FormHeader TitleText="EDITING TEMPLATE LAYOUT" DescriptionText="Template Fields" Margin="0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="165"/>
                    <RowDefinition Height="152*"/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="400"/>
                    <ColumnDefinition Width="150*"/>
                </Grid.ColumnDefinitions>

                <Grid Grid.Row="0" Grid.Column="1">
                    <data:Navigator  Height="165" VerticalAlignment="Top" VisibilityButtonFind="Collapsed" Margin="0,0,0,0">
                        <Grid Margin="0,0,0,0" Height="130">

                            <toolkit:ColorPicker Name="colorPicker" SelectedColor="{Binding SelectedItem.Color, Converter={StaticResource ColorConverter}, Mode=TwoWay}" ShowStandardColors="True" Margin="454,97,0,0" DisplayColorAndName="True" HorizontalAlignment="Left" Width="136" Height="23" VerticalAlignment="Top"></toolkit:ColorPicker>

                            <TextBlock Grid.Column="0" Text="X Position :" Margin="32,16,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="61"></TextBlock>
                            <TextBox Grid.Column="0" Text="{Binding SelectedItem.X, Mode=TwoWay}" HorizontalAlignment="Left" Margin="98,15,0,0" VerticalAlignment="Top" Width="58" FontSize="14" FontWeight="Bold" />
                            <TextBlock Grid.Column="0" Text="Y Position :" Margin="166,16,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="61"/>
                            <TextBox Grid.Column="0" Text="{Binding SelectedItem.Y, Mode=TwoWay}" HorizontalAlignment="Left" Margin="234,15,0,0" VerticalAlignment="Top" Width="58" FontSize="14" FontWeight="Bold" />
                            <ComboBox ItemsSource="{Binding AllFields,Mode=TwoWay}" SelectedItem="{Binding SelectedItem.FieldName, Mode=TwoWay}" Margin="98,41,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="194"/>
                            <TextBlock Grid.Column="0" Text="Field :" Margin="32,41,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="61"/>
                            <ComboBox ItemsSource="{Binding AllFontFamilies, Mode=TwoWay}" SelectedItem="{Binding SelectedItem.FontFamily, Mode=TwoWay}" Margin="98,70,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="492"/>
                            <TextBlock Grid.Column="0" Text="Font Familiy :" Margin="21,70,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="72"/>
                            <ComboBox ItemsSource="{Binding AllFontSizes, Mode=TwoWay}" SelectedItem="{Binding SelectedItem.FontSize, Mode=TwoWay}" Margin="98,98,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="68"/>
                            <TextBlock Grid.Column="0" Text="Font Size:" Margin="21,98,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="72"/>
                            <ComboBox ItemsSource="{Binding AllFontDecorations, Mode=TwoWay}" SelectedItem="{Binding SelectedItem.FontWeight, Mode=TwoWay}" Margin="275,98,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="119"/>
                            <TextBlock Grid.Column="0" Text="Font Decoration :" Margin="174,98,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="99"/>

                            <CheckBox Margin="309,44,171,0" IsChecked="{Binding SelectedItem.IsPicturePath, Mode=TwoWay}" Content="Is Picture Path" Height="22" VerticalAlignment="Top"></CheckBox>
                            <TextBlock Grid.Column="0" Text="Height :" Margin="332,17,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="43"/>
                            <TextBox Grid.Column="0" Text="{Binding SelectedItem.Height, Mode=TwoWay}" HorizontalAlignment="Left" Margin="381,16,0,0" VerticalAlignment="Top" Width="74" FontSize="14" FontWeight="Bold" />
                            <TextBlock Grid.Column="0" Text="Width :" Margin="466,17,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="43"/>
                            <TextBox Grid.Column="0" Text="{Binding SelectedItem.Width, Mode=TwoWay}" HorizontalAlignment="Left" Margin="512,16,0,0" VerticalAlignment="Top" Width="78" FontSize="14" FontWeight="Bold" />
                            <CheckBox Margin="429,44,51,0" IsChecked="{Binding SelectedItem.IsQRCode, Mode=TwoWay}" Content="Is QR Code" Height="22" VerticalAlignment="Top"/>
                            <CheckBox Margin="429,-24,51,0" IsChecked="{Binding SelectedItem.IsDisabled, Mode=TwoWay}" Content="Is Disabled" Height="22" VerticalAlignment="Top"/>
                            <TextBlock Grid.Column="0" Text="Color :" Margin="408,98,0,0" Height="20" VerticalAlignment="Top" HorizontalAlignment="Left" Width="41"/>

                        </Grid>
                    </data:Navigator>

                </Grid>

                <DataGrid Grid.RowSpan="2" Grid.Column="0" IsReadOnly="True" AutoGenerateColumns="False" ItemsSource="{Binding Items,Mode=TwoWay}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Field" Binding="{Binding FieldName}"/>
                        <DataGridTextColumn Header="X" Binding="{Binding X}"/>
                        <DataGridTextColumn Header="Y" Binding="{Binding Y}"/>
                        <DataGridTextColumn Header="Height" Binding="{Binding Height}"/>
                        <DataGridTextColumn Header="Width" Binding="{Binding Width}"/>
                        <DataGridTemplateColumn Width="60" Header="IsPicture">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <CheckBox HorizontalAlignment="Center"  IsChecked="{Binding IsPicturePath}"/>
                                    </Grid>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>

                        <DataGridTemplateColumn Width="55" Header="QRCode">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <CheckBox HorizontalAlignment="Center"  IsChecked="{Binding IsQRCode}"/>
                                    </Grid>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="55" Header="Disabled">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <CheckBox HorizontalAlignment="Center"  IsChecked="{Binding IsDisabled}"/>
                                    </Grid>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>


                <ScrollViewer Grid.Row="1" Grid.Column="1" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
                    <Grid>
                        <Image Name="imgFace"  HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0"/>
                        <userControls:DynamicCanvas SelectedItem="{Binding SelectedItem, Mode=TwoWay}" x:Name="dynamicCanvas" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0" />
                    </Grid>

                </ScrollViewer>

            </Grid>
        </controls:FormHeader>
    </Grid>
</UserControl>
